<template>
  <view class="statistics">
    <app-gong :info="{title:'信息统计'}">
      <template #content>
        <view class="list">
          <u-grid :col="4">
            <u-grid-item>
              <u-count-to :start-val="0" :end-val="form.MrkCount" color="#1677ff"></u-count-to>
              <view class="grid-text">
                个超市</view>
            </u-grid-item>
            <u-grid-item>
              <u-count-to :start-val="0" :end-val="form.ProCount" color="#1677ff"></u-count-to>
              <view class="grid-text">
                个商品</view>
            </u-grid-item>
            <u-grid-item>
              <u-count-to :start-val="0" :end-val="form.OrderCount" color="#1677ff"></u-count-to>
              <view class="grid-text">
                个订单</view>
            </u-grid-item>
            <u-grid-item>
              <u-count-to :start-val="0" :end-val="form.MoneyCount" color="#1677ff"></u-count-to>
              <view class="grid-text">
                ￥交易</view>
            </u-grid-item>
          </u-grid>
          <view class="item">
            <u-table>
              <u-tr>
                <u-th>订单统计</u-th>
              </u-tr>
              <u-tr>
                <u-td>未处理订单</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.OrderNoAudit}}</span>个</view>
                </u-td>
              </u-tr>
              <u-tr>
                <u-td>待送货订单</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.OrderNoDef}}</span>个</view>
                </u-td>
              </u-tr>
              <u-tr>
                <u-td>待结算订单</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.OrderNoPay}}</span>个</view>
                </u-td>
              </u-tr>
              <u-tr>
                <u-td>已成交订单数</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form. OrderSettled}}</span>个</view>
                </u-td>
              </u-tr>
              <u-tr>
                <u-td>交易失败</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.OrderNotPass}}</span>个</view>
                </u-td>
              </u-tr>
            </u-table>
          </view>

          <view class="item">
            <u-table>
              <u-tr>
                <u-th>商品统计信息</u-th>
              </u-tr>
              <u-tr>
                <u-td>商品总数</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.ProCount}}</span>个</view>
                </u-td>
              </u-tr>
              <u-tr>
                <u-td>库存预警</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.ProWarning}}</span>个</view>
                </u-td>
              </u-tr>
              <u-tr>
                <u-td>商品缺货</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.ProNo}}</span>个</view>
                </u-td>
              </u-tr>
              <u-tr>
                <u-td>临期商品</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.ProWarning}}</span>个</view>
                </u-td>
              </u-tr>
            </u-table>
          </view>

          <view class="item">
            <u-table>
              <u-tr>
                <u-th> 拜访任务统计</u-th>
              </u-tr>
              <u-tr>
                <u-td>拜访总数</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.TaskCount}}</span>次</view>
                </u-td>
              </u-tr>
              <u-tr>
                <u-td>已拜访</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.TaskDo}}</span>次</view>
                </u-td>
              </u-tr>
              <u-tr>
                <u-td>未拜访</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.TaskNo}}</span>次</view>
                </u-td>
              </u-tr>
            </u-table>
          </view>

          <view class="item">
            <u-table>
              <u-tr>
                <u-th>送货统计</u-th>
              </u-tr>
              <u-tr>
                <u-td>送货订单总数</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.DefCount}}</span>次</view>
                </u-td>
              </u-tr>
              <u-tr>
                <u-td>已送</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.DefDo}}</span>次</view>
                </u-td>
              </u-tr>
              <u-tr>
                <u-td>未送</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.DefNo}}</span>次</view>
                </u-td>
              </u-tr>
            </u-table>
          </view>
          <view class="item">
            <u-table>
              <u-tr>
                <u-th>考勤统计</u-th>
              </u-tr>
              <u-tr>
                <u-td>员工总数</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.KUserCount }}</span>人</view>
                </u-td>
              </u-tr>
              <u-tr>
                <u-td>今日打卡</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.KDaKa }}</span>人</view>
                </u-td>
              </u-tr>
              <u-tr>
                <u-td>今日未打卡</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.KNo }}</span>人</view>
                </u-td>
              </u-tr>
              <u-tr>
                <u-td>迟到、早退</u-td>
                <u-td>
                  <view class="el-flex"><span class="selected">{{form.KZao }}</span>人</view>
                </u-td>
              </u-tr>
            </u-table>
          </view>
        </view>
      </template>
    </app-gong>
  </view>
</template>

<script>
import appGong from '@/components/app-gong'
export default {
  components: {
    appGong
  },
  data() {
    return {
      form: {}
    }
  },
  mounted() {
    let token = uni.getStorageInfoSync('token')
    if (!token) return false
    this.$axios('/api/Total/GetMainInfo', 'post').then(res => {
      console.log(res)
      this.form = res.Value
    })
  }
}
</script>

<style lang="scss" scoped>
.list {
  width: 100%;
  padding: 0 24rpx;
  .selected {
    color: red;
    font-size: 30rpx;
    margin-right: 10rpx;
  }
  .item {
    margin-top: 30rpx;
  }
}
</style>
